#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#include <ncs_rpg>

#define VERSION		"Beta 1.0.0"

new ThisSkillID;
new Float:SkillAmount;

public Plugin:myinfo =
{
	name		= "[NCS RPG] Skill Gravity",
	author		= "[RUS] DiviX",
	description	= "Skill Gravity for NCS RPG",
	version		= VERSION,
	url			= "N/A"
};

public RPG_OnSkillsRegister()
{
	ThisSkillID = RegisterSkill("gravity", 10, 10, 10);
	SkillAmount = GetConfigValueFloat("gravity", "percent", 5.0)*0.01;
}

public Action:RPG_OnSkillUP(&client, &skillid, &old_value, &new_value)
{
	if(skillid != ThisSkillID)
		return;
	
	SetEntityGravity(client, 1.0-(new_value*SkillAmount));
}

public OnGameFrame() // ladder bug
{
	for(new client = 1; client <= MaxClients; client++)
	{
		if(IsValidPlayer(client, true))
		{
			new level = GetSkillLevel(client, ThisSkillID);
			if(level > 0)
				SetEntityGravity(client, 1.0-(level*SkillAmount));
		}
	}
}